var mongoose = require("./db.js");

var schema = mongoose.Schema; //模型生成器(表生成器)

//建立表 并且指定字段
var leavesSchema = new schema({
    userid: String,
    username: String,
    reson: String,
    start: Date,
    end: Date,
    extend: String,
    type: Number,//审批状态  1:待审批  2:通过 3：拒绝
});

//转成数据模型导出  取名为userinfos 根据userSchem去生成 在mongodb中生成的表为多一个s
//表名会变成userinfos
module.exports = mongoose.model("leaveslists", leavesSchema);